package com.hsh.maoduo.pojo.vo;

import com.hsh.maoduo.util.DataUtil;
import lombok.Data;
import org.apache.logging.log4j.util.Strings;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

@Data
public class CountVO {
    /**
     * 统计的时间类型
     */
    private String dateType;
    /**
     * 0-全部 1-入库 2-出库
     */
    private Integer inOutType;

    /**
     *
     */
    private String goodsName;

    /**
     *
     */
    private String supplierOrShopName;
    /**
     *
     */
    private List<String> supplierOrShopNameList;


    /**
     *
     */
    private Integer num;

    /**
     *
     */
    private BigDecimal boxNum;
    /**
     * 条件筛选  开始时间
     */
    private String startDateTime;
    /**
     * 条件筛选  结束时间
     */
    private String endDateTime;

    /**
     * 核销状态 0-未核销 1-已核销
     */
    private Integer isVerified;

    /**
     * 是否统计所有店铺(或供应商)的数据 null-按店铺(或供应商)分组  1或者非null-统计所有店铺(或供应商)
     */
    private Integer isSumOfAllShopOrSupplier;

    public void init() {
        this.goodsName = DataUtil.removeSpaceAndSymbols(this.goodsName);
        //supplierOrShopName 处理
        if (Strings.isBlank(this.supplierOrShopName)) {
            return;
        }
        if ("all".equals(this.supplierOrShopName)) {
            this.supplierOrShopName = "";
            this.isSumOfAllShopOrSupplier = 1;
        }
        this.supplierOrShopNameList = new ArrayList<>();
        String[] split = this.supplierOrShopName.trim().split("\\s");
        supplierOrShopNameList.addAll(Arrays.asList(split));
    }
}
